
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>section1 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.2">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="section2.html" />
    
    
    <link rel="prev" href="../chapter1.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../chapter1.html">
            
                <a href="../chapter1.html">
            
                    
                    chapter1
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.2.1" data-path="section1.html">
            
                <a href="section1.html">
            
                    
                    section1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="section2.html">
            
                <a href="section2.html">
            
                    
                    section2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="section3.html">
            
                <a href="section3.html">
            
                    
                    section3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="section4.html">
            
                <a href="section4.html">
            
                    
                    section4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="section5.html">
            
                <a href="section5.html">
            
                    
                    section5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="section6.html">
            
                <a href="section6.html">
            
                    
                    section6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="section7.html">
            
                <a href="section7.html">
            
                    
                    section7
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../chapter2.html">
            
                <a href="../chapter2.html">
            
                    
                    chapter2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../chapter3.html">
            
                <a href="../chapter3.html">
            
                    
                    chapter3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../chapter4.html">
            
                <a href="../chapter4.html">
            
                    
                    chapter4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../chapter5.html">
            
                <a href="../chapter5.html">
            
                    
                    chapter5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../chapter6.html">
            
                <a href="../chapter6.html">
            
                    
                    chapter6
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../chapter6/section1.html">
            
                <a href="../chapter6/section1.html">
            
                    
                    section1
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../chapter7.html">
            
                <a href="../chapter7.html">
            
                    
                    chapter7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../chapter8.html">
            
                <a href="../chapter8.html">
            
                    
                    chapter8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../chapter9.html">
            
                <a href="../chapter9.html">
            
                    
                    chapter9
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../chapter10.html">
            
                <a href="../chapter10.html">
            
                    
                    chapter10
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../chapter11.html">
            
                <a href="../chapter11.html">
            
                    
                    chapter11
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../chapter12.html">
            
                <a href="../chapter12.html">
            
                    
                    chapter12
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../chapter13.html">
            
                <a href="../chapter13.html">
            
                    
                    chapter13
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../chapter14.html">
            
                <a href="../chapter14.html">
            
                    
                    chapter14
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="../chapter15.html">
            
                <a href="../chapter15.html">
            
                    
                    chapter15
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.16.1" data-path="../chapter15/section1.html">
            
                <a href="../chapter15/section1.html">
            
                    
                    section15-1
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >section1</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x5B89;&#x88C5;docker">&#x5B89;&#x88C5;docker</h1>
<p>1&#xFF0C;<a href="https://github.com/boot2docker/boot2docker" target="_blank">Boot2Docker</a>&#xFF08;&#x5B98;&#x65B9;&#x5DF2;&#x5E9F;&#x5F03;&#xFF09;</p>
<pre><code>    Docker&#x5F15;&#x64CE;&#x4F7F;&#x7528;&#x4E86;Linux&#x5185;&#x6838;&#x7279;&#x5B9A;&#x7684;&#x7279;&#x6027;&#xFF0C;&#x6240;&#x4EE5;&#x8981;&#x8BA9;&#x5B83;&#x8FD0;&#x884C;&#x5728;OS X&#x4E0A;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x7528;&#x4E00;&#x4E2A;&#x8F7B;&#x91CF;&#x578B;&#x7684;&#x865A;&#x62DF;&#x673A;\(vm\)&#x3002;&#x7528;OS X&#x7684;Docker&#x5BA2;&#x6237;&#x7AEF;&#x6765;&#x63A7;&#x5236;&#x865A;&#x62DF;Docker&#x6765;&#x6784;&#x5EFA;&#xFF0C;&#x8FD0;&#x884C;&#x4EE5;&#x53CA;&#x7BA1;&#x7406;Docker&#x5BB9;&#x5668;&#x3002;&#x4E3A;&#x4E86;&#x4F7F;&#x8FC7;&#x7A0B;&#x66F4;&#x7B80;&#x5355;&#x4E00;&#x70B9;&#xFF0C;&#x8BBE;&#x8BA1;&#x4E86;&#x4E00;&#x4E2A;&#x53EB;&#x505A;[Boot2Docker](https://github.com/boot2docker/boot2docker)&#x7684;&#x5E2E;&#x52A9;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#xFF0C;&#x5B83;&#x80FD;&#x6309;&#x7167;&#x865A;&#x62DF;&#x673A;&#x4EE5;&#x53CA;&#x8FD0;&#x884C;Docker&#x540E;&#x53F0;&#x7A0B;&#x5E8F;&#x3002;

 $boot2docker init

 $ boot2docker start

 $ export DOCKER\_HOST=tcp://$\(boot2docker ip 2&amp;gt;/dev/null\):2375
</code></pre><p>&#x5B8C;&#x6210;&#x865A;&#x62DF;&#x5316;&#x73AF;&#x5883;&#x642D;&#x5EFA;&#x3002;</p>
<p>$ docker run ubuntu echo hello world</p>
<p>&#x4E0B;&#x8F7D;ubuntu&#x955C;&#x50CF;&#x5E76;&#x6253;&#x5370;hello world&#x3002;</p>
<p>2&#xFF0C;docker-for-mac</p>
<p>&#x4E0B;&#x8F7D;&#x5730;&#x5740;&#xFF1A;<a href="https://docs.docker.com/docker-for-mac/" target="_blank">https://docs.docker.com/docker-for-mac/</a></p>
<p>&#x5982;&#x679C;&#x5B89;&#x88C5;&#x5931;&#x8D25;&#xFF1A;</p>
<p>$ docker ps</p>
<p>-bash: docker: command not found</p>
<p>$ docker run -d -p 80:80</p>
<p>-bash: docker: command not found</p>
<p>&#x5982;&#x679C;&#x5B89;&#x88C5;&#x6210;&#x529F;&#xFF1A;<br> $ docker info</p>
<p>Containers: 0</p>
<p>Running: 0</p>
<p>Paused: 0</p>
<p>Stopped: 0</p>
<p>Images: 0</p>
<p>Server Version: 17.03.1-ce</p>
<p>Storage Driver: overlay2</p>
<p>Backing Filesystem: extfs</p>
<p>Supports d_type: true</p>
<p>Native Overlay Diff: true</p>
<p>Logging Driver: json-file</p>
<p>Cgroup Driver: cgroupfs</p>
<p>Plugins:</p>
<p>Volume: local</p>
<p>Network: bridge host ipvlan macvlan null overlay</p>
<p>Swarm: inactive</p>
<p>Runtimes: runc</p>
<p>Default Runtime: runc</p>
<p>Init Binary: docker-init</p>
<p>containerd version: 4ab9917febca54791c5f071a9d1f404867857fcc</p>
<p>runc version: 54296cf40ad8143b62dbcaa1d90e520a2136ddfe</p>
<p>init version: N/A (expected: 949e6facb77383876aeff8a6944dde66b3089574)</p>
<p>Security Options:</p>
<p>seccomp</p>
<p>Profile: default</p>
<p>Kernel Version: 4.9.13-moby</p>
<p>Operating System: Alpine Linux v3.5</p>
<p>OSType: linux</p>
<p>Architecture: x86_64</p>
<p>CPUs: 2</p>
<p>Total Memory: 1.952 GiB</p>
<p>Name: moby</p>
<p>ID: MTBS:V3B2:D4PM:4G3G:RRI6:HFDV:PJ73:A6DP:7KYA:A2G7:AHG6:K4JX</p>
<p>Docker Root Dir: /var/lib/docker</p>
<p>Debug Mode (client): false</p>
<p>Debug Mode (server): true</p>
<p>File Descriptors: 16</p>
<p>Goroutines: 26</p>
<p>System Time: 2017-04-28T08:28:21.556923057Z</p>
<p>EventsListeners: 1</p>
<p>Http Proxy: 127.0.0.1:8888</p>
<p>Https Proxy: 127.0.0.1:8888</p>
<p>Registry: <a href="https://index.docker.io/v1/" target="_blank">https://index.docker.io/v1/</a></p>
<p>Experimental: true</p>
<p>Insecure Registries:</p>
<p>127.0.0.0/8</p>
<p>Live Restore Enabled: false</p>
<p>$ docker images</p>
<p>REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE</p>
<p>$ docker ps</p>
<p>CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES</p>
<p>$  docker run hello-world</p>
<p>Unable to find image &apos;hello-world:latest&apos; locally</p>
<p>docker: Error response from daemon: Get <a href="https://registry-1.docker.io/v2/" target="_blank">https://registry-1.docker.io/v2/</a>: http: error connecting to proxy <a href="http://127.0.0.1:8888" target="_blank">http://127.0.0.1:8888</a>: dial tcp 127.0.0.1:8888: getsockopt: connection refused.</p>
<p>See &apos;docker run --help&apos;.</p>
<p>&#x53D1;&#x73B0;&#x5931;&#x8D25;&#xFF0C;&#x91CD;&#x8BD5;&#x4ECD;&#x7136;&#x5931;&#x8D25;</p>
<p>$  docker run tag</p>
<p>Unable to find image &apos;tag:latest&apos; locally</p>
<p>docker: Error response from daemon: Get <a href="https://registry-1.docker.io/v2/" target="_blank">https://registry-1.docker.io/v2/</a>: http: error connecting to proxy <a href="http://127.0.0.1:8888" target="_blank">http://127.0.0.1:8888</a>: dial tcp 127.0.0.1:8888: getsockopt: connection refused.</p>
<p>See &apos;docker run --help&apos;.</p>
<p>$   docker run -d -p 80:80 --name webserver nginx</p>
<p>Unable to find image &apos;nginx:latest&apos; locally</p>
<p>docker: Error response from daemon: Get <a href="https://registry-1.docker.io/v2/" target="_blank">https://registry-1.docker.io/v2/</a>: http: error connecting to proxy <a href="http://127.0.0.1:8888" target="_blank">http://127.0.0.1:8888</a>: dial tcp 127.0.0.1:8888: getsockopt: connection refused.</p>
<p>See &apos;docker run --help&apos;.</p>
<p>$   docker run -d -p 80:80 --name webserver nginx</p>
<p>docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.</p>
<p>See &apos;docker run --help&apos;.</p>
<p>$ docker ps</p>
<p>Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?</p>
<p>$    docker run docker/whalesay cowsay boo</p>
<p>Unable to find image &apos;docker/whalesay:latest&apos; locally</p>
<p>docker: Error response from daemon: Get <a href="https://registry-1.docker.io/v2/" target="_blank">https://registry-1.docker.io/v2/</a>: http: error connecting to proxy <a href="http://127.0.0.1:8888" target="_blank">http://127.0.0.1:8888</a>: dial tcp 127.0.0.1:8888: getsockopt: connection refused.</p>
<p>See &apos;docker run --help&apos;.</p>
<p>&#x4EE3;&#x7406;&#x6709;&#x95EE;&#x9898;&#xFF1A;&#x6253;&#x5F00;docker/prefrence</p>
<p><img src="../assets/import.png" alt=""></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../chapter1.html" class="navigation navigation-prev " aria-label="Previous page: chapter1">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="section2.html" class="navigation navigation-next " aria-label="Next page: section2">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"section1","level":"1.2.1","depth":2,"next":{"title":"section2","level":"1.2.2","depth":2,"path":"chapter1/section2.md","ref":"chapter1/section2.md","articles":[]},"previous":{"title":"chapter1","level":"1.2","depth":1,"path":"chapter1.md","ref":"chapter1.md","articles":[{"title":"section1","level":"1.2.1","depth":2,"path":"chapter1/section1.md","ref":"chapter1/section1.md","articles":[]},{"title":"section2","level":"1.2.2","depth":2,"path":"chapter1/section2.md","ref":"chapter1/section2.md","articles":[]},{"title":"section3","level":"1.2.3","depth":2,"path":"chapter1/section3.md","ref":"chapter1/section3.md","articles":[]},{"title":"section4","level":"1.2.4","depth":2,"path":"chapter1/section4.md","ref":"chapter1/section4.md","articles":[]},{"title":"section5","level":"1.2.5","depth":2,"path":"chapter1/section5.md","ref":"chapter1/section5.md","articles":[]},{"title":"section6","level":"1.2.6","depth":2,"path":"chapter1/section6.md","ref":"chapter1/section6.md","articles":[]},{"title":"section7","level":"1.2.7","depth":2,"path":"chapter1/section7.md","ref":"chapter1/section7.md","articles":[]}]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"chapter1/section1.md","mtime":"2017-04-28T11:48:27.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-04-28T12:19:03.600Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

